xml.instruct!

xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/" do
  xml.channel do

    xml.title       "#{Settings.short_title} Podcasts"
    xml.link        url_for :only_path => false, :controller => 'posts'
    xml.pubDate     CGI.rfc1123_date @podcasts.first.updated_at if @podcasts.any?
    xml.description "#{Settings.short_title} Podcasts"

    @podcasts.each do |podcast|
      xml.item do
        xml.title       podcast.title
        xml.link        url_for :only_path => false, :controller => 'podcast', :action => 'show', :id => podcast
        xml.description podcast.body
        xml.pubDate     CGI.rfc1123_date podcast.updated_at
        xml.guid        url_for :only_path => false, :controller => 'podcast', :action => 'show', :id => podcast
        xml.author      "#{podcast.author.email} (#{podcast.author.name})"
        # This involves a nasty hack to get it to insert the full URL to the file
        xml.enclosure(:type => podcast.content_type,
                        :length => podcast.size.to_s,
                        :url => url_for(:controller => "/", :only_path => false).gsub("/", "") + podcast.public_filename
                  )
      end
    end

  end
end